package com.wyk.redis;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListener;

public class CustomSessionListener implements SessionListener {

	@Override
	public void onExpiration(Session session) {
		out(session);
		System.out.println("CustomSessionListener onExpiration");
	}

	@Override
	public void onStart(Session session) {
		out(session);
		System.out.println("CustomSessionListener onStart");
	}

	@Override
	public void onStop(Session session) {
		out(session);
		System.out.println("CustomSessionListener onStop");
	}
	
	private void out(Session session){
		String id = null;
		if(session!=null && session.getId()!=null){
			id = session.getId().toString();
		}
		System.out.print("sessionId is："+id+"，");
	}
	
}
